/**
 *  Copyright 2006-2007 EmbedChat
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package org.embedchat.desktop;

import java.io.File;

public class Config {

    private static Config ourInstance = new Config();

    private File configsFolder = null;
    private File resourcesFolder = null;
    private File workDirectory = null;
    private File smilesFolder = null;

    public Config() {
        String workDir = System.getProperty("embedchat.work.dir");
        if (workDir != null) {
            workDirectory = new File(workDir);
        } else {
            workDirectory = new File("work");
        }
        if (!workDirectory.exists()) {
            workDirectory.mkdir();
        }
        String resourcesDir = System.getProperty("embedchat.resources.dir");
        if (resourcesDir != null) {
            resourcesFolder = new File(resourcesDir);
        } else {
            resourcesFolder = new File("resources");
        }
        if (!resourcesFolder.exists()) {
            resourcesFolder.mkdir();
        }
        smilesFolder = new File(resourcesFolder.getAbsolutePath() + File.separator + "smiles");
    }

    public static Config getInstance() {
        return ourInstance;
    }

    public File getConfigsFolder() {
        return configsFolder;
    }

    public void setConfigsFolder(File configsFolder) {
        this.configsFolder = configsFolder;
    }

    public File getSmilesFolder() {
        return smilesFolder;
    }

    public void setSmilesFolder(File smilesFolder) {
        this.smilesFolder = smilesFolder;
    }

    public File getWorkDirectory() {
        return workDirectory;
    }

    public void setWorkDirectory(File workDirectory) {
        this.workDirectory = workDirectory;
    }
}
